var a = getApp();

Component({
    properties: {
        show: {
            type: Boolean,
            value: !1
        },
        member_item: {
            type: null
        }
    },
    data: {
        name: "",
        img_url: ""
    },
    observers: {
        member_item: function(a) {
            // console.log("aaaaaaaaaaa", a), 
            // this.setData({
            //     name: a.nickname
            // });
        }
    },
    lifetimes: {
        attached: function() {},
        ready: function() {}
    },
    methods: {
        onClose: function(a) {
            this.setData({
                show: !1
            }), this.triggerEvent("onClose", {
                name: this.data.name,
                avatar: this.data.avatar
            });
        },
        bindblurM: function(a) {
            this.setData({
                name: a.detail.value
            });
        },
        afterRead: function(t) {
            var e = this;
            console.log("图片", t);
            var o = a.getNetAddresss("upload.uploadPic");
            wx.uploadFile({
                url: o,
                filePath: t.detail.avatarUrl,
                name: "file",
                formData: null,
                success: function(a) {
                    var o = JSON.parse(a.data);
                    console.log(o, "ddd"), e.setData({
                        img_url: t.detail.avatarUrl,
                        avatar: o.data.img
                    }), console.log(t.detail.avatarUrl, "dddddsa");
                }
            });
        },
        saveMethod: function() {
            var t = this, e = a.getNetAddresss("member.member-info.userNicknameSave");
            a._postNetWork({
                url: e,
                data: {
                    avatar: this.data.member_item.avatar ? this.data.member_item.avatar : this.data.avatar,
                    nickname: this.data.name ? this.data.name : ""
                },
                success: function(a) {
                    var e = a.data;
                    1 == e.result ? (wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1e3
                    }), t.onClose()) : wx.showToast({
                        icon: "none",
                        title: e.msg,
                        duration: 1e3
                    });
                },
                fail: function(a) {
                    console.log(a);
                }
            });
        }
    }
});